package com.ehome.poct.core.pasre.report.text;


import com.ehome.poct.base.api.enums.StripTypeEnums;
import com.ehome.poct.core.pasre.report.text.dto.ReportTextDTO;

import java.math.BigDecimal;

/**
 * @auther: kuiba.peng
 * @date: 2022/11/10 16:01
 * @description: 默认逻辑
 */
public class DefaultTextStrategy implements TextStrategy {

    @Override
    public StripTypeEnums getStripType() {
        return StripTypeEnums.DEFAULT_TYPE;
    }

    @Override
    public String getReportText(ReportTextDTO reportTextDTO) {
        BigDecimal minValue = reportTextDTO.getMinValue();
        BigDecimal maxValue = reportTextDTO.getMaxValue();
        BigDecimal checkResult = reportTextDTO.getCheckResult();
        if (checkResult.compareTo(maxValue) >= 0) {
            return "≥" + maxValue + reportTextDTO.getSymbol();
        } else if (checkResult.compareTo(minValue) <= 0) {
            return "≤" + minValue + reportTextDTO.getSymbol();
        }
        return checkResult + reportTextDTO.getSymbol();
    }
}
